import {View} from "@tarojs/components";

export default function Table({col, tableData}) {
  console.log('tableData', tableData)
  return (
    <View className='table'>
      <View className='table-header-group'>
        {
          col.map((item, index) => {
            return (
              <View key={index} className='table-th'>
                {item.name}
              </View>
            )
          })
        }
      </View>
      <View className='table-row-group'>
        {
          tableData.map((data, idx) => {
            return (
              <View key={idx} className='table-tr'>
                {
                  col.map((item, index) => {
                    return (
                      <View key={index} className='table-td'>
                        {data[item.key]}
                      </View>
                    )
                  })
                }
              </View>
            )
          })
        }
      </View>
    </View>
  )
}
